<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function checkAdd(){
		var deptno = document.getElementById("deptno").value;
		var dname = document.getElementById("dname").value;
		var loc = document.getElementById("loc").value;
		
		if(deptno== ""){
			document.getElementById("s1").innerHTML="<font color='red'>部门编号不能为空</font>";
			return false;
		}else if(dname== ""){
			document.getElementById("s2").innerHTML="<font color='red'>部门名称不能为空</font>";
			return false;
		}else if(loc== ""){
			document.getElementById("s3").innerHTML="<font color='red'>工作地点不能为空</font>";
			return false;
		
		}else{
			return ture;
		}
	}
</script>
</head>
<body>
	<form action="../addDept" method="post" onsubmit="return checkAdd()">
	<table>
		<tr>
			<td>部门编号：<input type="text" name="deptno" id="deptno" >
			<span id="s1"></span>
			</td>
		</tr>
		<tr>
			<td>部门名称：<input type="text" name="dname" id="dname">
			<span id="s2"></span>
			</td>
		</tr>
		<tr>
			<td>工作地点：<input type="text" name="loc" id="loc">
			<span id="s3"></span>
			</td>
		</tr>
		
		<tr>
			<td><input type="submit" value="添加"></td>
		</tr>

	</table>
</form>
</body>
</html>